<?php
/**
 * Created by PhpStorm.
 * User: zyark
 * Date: 2017/6/1
 * Time: 09:46
 */

namespace Home\Logic;


class NoticeLogic
{
    /**
     * 分页获取公告列表
     * @param $pagenum 页数
     * @param int $pagesize 每页数量
     * @return mixed
     */
    public function getNoticeList($pagenum,$pagesize=10){
        $startno = ($pagenum - 1) * $pagesize;
        $limit = $startno . ',' . $pagesize;//每页的数据数和内容$limit
        $noticeList = D('Notice')
            ->join('LEFT JOIN tp_notice_category c ON c.id=tp_notice.category_id')
            ->limit($limit)
            ->order('tp_notice.id desc')
            ->field('tp_notice.*,c.name as category_name')
            ->select();
        return $noticeList;
    }
}